﻿@{
    ViewBag.Title = "EditCustomer";
    Layout = null;
}

<h2>Customer Details</h2>
<button onclick="location.href='/Home/CustomerView'">Back</button>

<!--<table>

    <tr>
        <td>Name</td> <td><input id="name" type="text" /></td>

    </tr>
</table>-->

@using (Html.BeginForm())
{

<table>
    <tr>
        <td>Name</td>
        <td>Address</td>
        <td>Age</td>
        <td>Profession</td>
        <td>Created on</td>
    </tr>
   
    <tr>
        <td>@Html.TextBox("Name", (string)ViewBag.ModelDetails.Name)</td>           
        <td>@Html.TextBox("Address", (string)ViewBag.ModelDetails.Address)</td>
        <td>@Html.TextBox("Age", (int)ViewBag.ModelDetails.Age)</td>
        <td><select id="profId">
            
            @foreach (var val in ViewBag.ProfessionDetails)
            {
                  <!--<option value= @val.ID>@val.Name</option>-->
                  if(val.ID != ViewBag.ModelDetails.ID)
                  {
                        <option value= @val.ID>@val.Name</option>
                  }
                  else
                  {
                        <option value= @val.ID selected="selected" >@val.Name</option>
                  }
            }
            </select>
        </td>     
        <td>@ViewBag.ModelDetails.Created_on</td>
     </tr>
      
    
</table>
    <input type="submit" value="Save" />      
}